package com.twinkle.abmsspringboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 启动时跳转到登录页
 *
 * @author Twinkle
 * @since 4 Aug. 2021
 */
@Controller
public class IndexController {
    /**
     * 页面跳转至 login.html
     *
     * @return login.html
     */
    @GetMapping("/")
    public String toLoginPage() {
        return "login";
    }

    /**
     * 页面跳转至 main.html
     *
     * @return main.html
     */
    @Deprecated
    public String toMainPage() {
        return "main";
    }

    /**
     * 页面跳转至 error.html
     *
     * @return error.html
     */
//    @Deprecated
    @RequestMapping("")
    public String toErrorPage() {
        return "error";
    }

    @Deprecated
    @RequestMapping("/info")
    public String toMessagePage(Model model) {
        if (false) {
            model.addAttribute("msg", "注册成功");
        } else {
            model.addAttribute("msg", "注册失败");
        }
        return "message";
    }
}
